namespace DotNetNuke.Services.FileSystem
{
    using System;

    public class FileManagerFunctions
    {
        public static string CReplace(string strExpression, string strSearch, string strReplace, int intMode)
        {
            if (intMode == 1)
            {
                string strReturn = "";
                strSearch = strSearch.ToUpper();
                string strTemp = strExpression.ToUpper();
                for (int lngPosition = strTemp.IndexOf(strSearch); lngPosition >= 0; lngPosition = strTemp.IndexOf(strSearch))
                {
                    strReturn = strReturn + strExpression.Substring(0, lngPosition) + strReplace;
                    strExpression = strExpression.Substring(lngPosition + strSearch.Length);
                    strTemp = strTemp.Substring(lngPosition + strSearch.Length);
                }
                return (strReturn + strExpression);
            }
            return strExpression.Replace(strSearch, strReplace);
        }
    }
}

